import { CmdCode } from '../code/index';
import { CmdSignModel, CustomerModel } from '../models/index';
import { AHttpCmd } from './base.cmd';
import { cacheService } from '../services';

export class SessionGetCmd extends AHttpCmd {
    constructor() {
        super();
    }

    req(): CmdSignModel {
        return super.buildCmdSign();
    }

    resp(model: CmdSignModel): void {
        let customer: CustomerModel = model.source;
        cacheService.setSession(customer);
    }

    getCmdCode(): string {
        return CmdCode.STORE_SESSION_GET;
    }

    getCmdVersion() {
        return '2'
    }

    returnStruct() {
        return {
            avatarUrl: '',
            id: '',
            mchId: '',
            shopId: '',
            name: '',
            memberId: '',
            levelId: '',
            superiorId: '',
            inviteCustomerId: '',
            inviteId: '',
            isCanary: '',
            memberVO: {
                id: '',
                levelId: '',
                mobile: '',
                memberLevelVO: {
                    name: '',
                }
            },
            mchMerchantVO: {
                isCrossBorder: '',
                mchMerchantCountryVOList: {
                    exchangeRate: '',
                    sbiCountryVO: {
                        code: '',
                        currency: '',
                    }
                },
                mchMerchantAppVO: {
                    category: '',
                    aboutMemberImg: ''
                },
                mchMerchantWmsVO: {
                    freeShippingAmount: '',
                    appletFreeShippingAmount: '',
                    appletUnFreeShippingArea: '',
                    unFreeShippingArea: '',
                },
                mchMerchantShopVO: {
                    openCustomerLevel: '',
                    openPrivateDomain: ''
                }
            }
        }
    }
}
